function Promisee(executor){
    this.state = 'pending';
    this.result = undefined;
    const _onChange = function (state,value){
        if(this.state !== 'pending') return;
        this.state = state;
        this.result = value;
    }
    try {
        executor(_onChange.bind(this,'fulfilled'),_onChange.bind(this,'rejected'))
    }catch(err){
        _onChange.call(this,'rejected',err)
    }

}
const p = new Promisee(function (resolve,reject){
    // resolve(100);
    // reject(200);
    throw 'xxx';
})

console.log(p);

